cmake_minimum_required(VERSION 3.0.2)
project(rikibot_foc_driver)

# 查找所有必要的包
find_package(catkin REQUIRED COMPONENTS
  roscpp
  tf
  tf2_ros
  nav_msgs
  sensor_msgs
  geometry_msgs
  tf2_msgs  # 添加 tf2_msgs
)

find_package(serial REQUIRED)

# 确保 CATKIN_DEPENDS 包含所有在 package.xml 中声明的依赖
catkin_package(
  INCLUDE_DIRS include
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS 
    roscpp 
    tf 
    tf2_ros 
    nav_msgs 
    sensor_msgs 
    geometry_msgs
    tf2_geometry_msgs  # 添加这行
    tf2_msgs  # 添加 tf2_msgs
)

include_directories(
  include
  ${catkin_INCLUDE_DIRS}
  ${serial_INCLUDE_DIRS}
)

add_executable(${PROJECT_NAME}_node
  src/rikibot_driver.cpp
)

target_link_libraries(${PROJECT_NAME}_node
  ${catkin_LIBRARIES}
  ${serial_LIBRARIES}
)

install(TARGETS ${PROJECT_NAME}_node
  RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY launch
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(DIRECTORY include/${PROJECT_NAME}/
  DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
